<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      >
    <!--Author : Dr. M H B Ariyaratne, MO(Health Information), buddhika.ari@gmail.com-->
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>#{labels.topic}</title>
<!--        <h:outputStylesheet library="css" name="style.css" />
        <h:outputStylesheet library="css" name="maincss.css" />-->
    </h:head>
    <h:body  >

        <h:form>


            <div id="background">
                <div id="page">
                    <div id="header" class="nonPrintBlock" style="float: right">
                        
                        <span id="infos">
                            <h:commandLink value="Staff Login" action="index" ></h:commandLink>
                            |
                            <h:commandLink value="Administrator" action="index" ></h:commandLink>
                        </span>
                        <h:commandLink action="index" ></h:commandLink>
                        <a href="#" id="logo"></a>

                        <!-- /#logo -->
                        
                    </div>
                    <!-- /#header -->
                    <div id="contents">
                        <div id="main" >

                            <p:commandButton styleClass="nonPrintBlock" ajax="false" value="Print" onclick="window.print();" actionListener="#{patientReportController.printPatientReport()}" />

                            <div>



                                <h:panelGroup rendered="#{patientReportController.currentPatientReport.item.reportType ne 'Microbiology'}"  >

                                    <div id="divReport"  style="min-width:21cm;min-height: 48cm!important; position: relative; font-size: 150%; background: url('/suwani/faces/javax.faces.resource/images/suwanireport.png') no-repeat ; background-size: 100%; ">



                                        <ui:repeat value="#{commonReportItemController.items}" var="myCli" >
                                            <div style="#{myCli.cssStyle}; position:absolute;">

                                                <h:outputText rendered="#{myCli.ixItemType eq 'Label' and myCli.retired ne true }"  value="#{myCli.name}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'PatientName' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.nameWithTitle}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'PatientAge' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.patient.age}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'PatientSex' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.sex}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'InvestigationName' and  myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.investigation.name}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'Speciman' and  myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.investigation.sample.name}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'SampledTime' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.sampledAt}" style="color: #{myCli.cssColor}" escape="false" >

                                                    <f:convertDateTime pattern="hh mm a"/>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'CollectingCenter' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.collectingCentre}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'BilledDate' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.createdAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="dd MMMM yyyy"></f:convertDateTime>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'BilledTime' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.createdAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="hh mm a"/>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'SampledDate' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.sampledAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="dd MMMM yyyy"></f:convertDateTime>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'BillNo' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.insId}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>

                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'ReportedDate' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.createdAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="dd MMMM yyyy"></f:convertDateTime>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'ReportedTime' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.createdAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="hh mm a"/>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'ReferringDoctor' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.referredBy.person.nameWithTitle}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>

                                                <p:graphicImage rendered="#{myCli.reportItemType eq 'AutherizedSignature' and myCli.retired eq false and patientReportController.currentPatientReport.approveUser.staff.id ne null }"    value="#{staffImageController.signatureById}" style="width: #{myCli.cssWidth}; max-height: 50px!important;"  >
                                                    <f:param name="id" value="#{patientReportController.currentPatientReport.approveUser.staff.id}" />
                                                </p:graphicImage>

                                            </div>
                                        </ui:repeat>


                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >

                                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                                <h:outputLabel value="#{prv.lobValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false}"  escape="false" />
                                            </div>
                                        </ui:repeat>

                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                                <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Varchar'}" escape="false" />
                                            </div>
                                        </ui:repeat>

                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                                <h:outputLabel value="#{prv.doubleValue}"  rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Double' and prv.investigationItem.retired eq false}"   escape="false" />
                                            </div>
                                        </ui:repeat>


                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                                <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'DynamicLabel'}" escape="false" />
                                            </div>
                                        </ui:repeat>

                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                                <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Flag'}" escape="false" />
                                            </div>
                                        </ui:repeat>

                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                                <h:outputLabel value="#{prv.doubleValue}" rendered="#{prv.investigationItem.ixItemType eq 'Calculation' }" escape="false" >
                                                    <f:convertNumber pattern="0.0" />
                                                </h:outputLabel>
                                            </div>
                                        </ui:repeat>

                                        <ui:repeat value="#{patientReportController.currentPatientReport.item.reportItems}" var="myIi" >
                                            <div style="#{myIi.cssStyle}; position:absolute;">
                                                <h:outputText rendered="#{myIi.retired ne true and myIi.ixItemType eq 'Label' }" value="#{myIi.name}" style="color: #{myIi.cssColor}" escape="false" ></h:outputText>
                                            </div>
                                        </ui:repeat>


                                    </div>
                                </h:panelGroup>


                                <h:panelGroup rendered="#{patientReportController.currentPatientReport.item.reportType eq 'Microbiology'}"  >
                                    <div id="divReportM"  style="min-width:800px;min-height: 1100px; position: relative; font-size: 150%;">
                                        <ui:repeat value="#{commonReportItemController.items}" var="myCli" >
                                            <div style="#{myCli.cssStyle}; position:absolute;">
                                                <h:outputText rendered="#{myCli.ixItemType eq 'Label' and myCli.retired ne true }"  value="#{myCli.name}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'PatientName' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.nameWithTitle}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'PatientAge' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.patient.age}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'PatientSex' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.sex}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'InvestigationName' and  myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.investigation.name}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'Speciman' and  myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.investigation.sample.name}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'SampledTime' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.sampledAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="hh mm a"/>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'BilledDate' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.createdAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="dd MMMM yyyy"></f:convertDateTime>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'BilledTime' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.createdAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="hh mm a"/>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'SampledDate' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.sampledAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="dd MMMM yyyy"></f:convertDateTime>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'BillNo' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.insId}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>

                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'ReportedDate' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.dataEntryAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="dd MMMM yyyy"></f:convertDateTime>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'ReportedTime' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.dataEntryAt}" style="color: #{myCli.cssColor}" escape="false" >
                                                    <f:convertDateTime pattern="hh mm a"/>
                                                </h:outputText>
                                                <h:outputText rendered="#{myCli.ixItemType ne 'Label' and myCli.reportItemType eq 'ReferringDoctor' and myCli.retired eq false }"  value="#{patientReportController.currentPatientReport.patientInvestigation.billItem.bill.referredBy.person.nameWithTitle}" style="color: #{myCli.cssColor}" escape="false" ></h:outputText>

                                                <h:panelGroup rendered="#{patientReportController.currentPatientReport.approveUser.staff.baImage ne null}">
                                                    <p:graphicImage rendered="#{myCli.reportItemType eq 'AutherizedSignature' and myCli.retired eq false }"    value="#{staffImageController.signatureById}" style="width: #{myCli.cssWidth}; max-height: 50px!important;"  >
                                                        <f:param name="id" value="#{patientReportController.currentPatientReport.approveUser.staff.id}" />
                                                    </p:graphicImage>


                                                </h:panelGroup>

                                            </div>
                                        </ui:repeat>



                                        <table id="micro" style="position: absolute; top: 35%; left:10%; font-size: 14px!important;" >
                                            <tr>
                                                <td>
                                                    <h:outputLabel value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                   #{patientReportController.currentPatientReport.patientInvestigation.investigation.printName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" 
                                                                   style="font-weight: bold;font-size: 20px!important; margin: 5px;padding: 5px; border: solid black 1px;"/>
                                                </td>
                                            </tr>
                                            <tr><td><h:outputLabel/></td></tr>
                                            <tr><td><h:outputLabel/></td></tr>
                                            <tr><td><h:outputLabel/></td></tr>
                                            <tr>
                                                <td id="micromemos">
                                                    <table  style="width: 100%!important;">                 
                                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >

                                                            <h:panelGroup rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false and prv.lobValue ne '' and prv.lobValue ne null and prv.investigationItem.transCssTop  lt 50 }" >
                                                                <tr >
                                                                    <td style="min-width: 250px; vertical-align: top;">
                                                                        <h:outputLabel value="#{prv.investigationItem.name}"  escape="false"  />
                                                                    </td>
                                                                    <td>
                                                                        <h:outputLabel value="#{prv.lobValue}"  escape="false" style="white-space: pre-wrap;" />
                                                                    </td>
                                                                </tr>
                                                            </h:panelGroup>

                                                            <h:panelGroup rendered="#{prv.investigationItem.ixItemType eq 'DynamicLabel' and prv.investigationItem.retired eq false and prv.investigationItem.transCssTop  lt 50 }" >
                                                                <tr >
                                                                    <td style="min-width: 250px;">
                                                                        <h:outputLabel value="#{prv.investigationItem.name}"  escape="false"  />
                                                                    </td>
                                                                    <td>

                                                                    </td>
                                                                </tr>
                                                            </h:panelGroup>



                                                        </ui:repeat>
                                                    </table>
                                                </td>
                                            </tr>
                                            <br/><br/>




                                            <tr>
                                                <td id="micLabelsBeforeAbst">

                                                    <ui:repeat value="#{patientReportController.currentPatientReport.item.reportItems}" var="myMicIi" >
                                                        <div style="#{myMicIi.cssStyle}; left: #{prvl.cssLeft};">
                                                            <h:outputText rendered="#{myMicIi.retired ne true and myMicIi.ixItemType eq 'List' }" 
                                                                          value="#{myMicIi.name}" style="color: #{myMicIi.cssColor}" escape="false" ></h:outputText>
                                                        </div>
                                                    </ui:repeat>


                                                </td>
                                            </tr>

                                            <tr>
                                                <td id="ablist">
                                                    <table>
                                                        <tr>
                                                            <td colspan="2"  >
                                                                <h:outputLabel value="Antibiotic Sensitivity Test" rendered="#{patientReportController.currentPatientReport.transHasAbst}" ></h:outputLabel>
                                                            </td>
                                                        </tr>
                                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" 
                                                                    var="prv" >
                                                            <h:panelGroup 
                                                                rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Varchar' and prv.investigationItem.retired eq false and prv.strValue ne '' and prv.strValue ne null  }" >
                                                                <tr>
                                                                    <td style="min-width: 250px;">
                                                                        <h:outputLabel value="#{prv.investigationItem.name}"  escape="false" />
                                                                    </td>
                                                                    <td>

                                                                        <h:outputLabel value="#{prv.strValue}" escape="false" />
                                                                    </td>
                                                                </tr>
                                                            </h:panelGroup>
                                                        </ui:repeat>
                                                    </table>

                                                </td>
                                            </tr>
                                            <br/><br/>
                                            <tr>
                                                <td id="miccomments">
                                                    <table>
                                                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                                            <h:panelGroup rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false and prv.lobValue ne '' and prv.lobValue ne null and prv.investigationItem.transCssTop gt 50 }" >

                                                                <tr>
                                                                    <td style="min-width: 250px;padding: 5px;padding-left: 1px; padding-right: 1px;">
                                                                        <h:outputLabel value="#{prv.investigationItem.name}"  escape="false" />
                                                                    </td>
                                                                    <td>
                                                                        <h:outputLabel value="#{prv.lobValue}"  escape="false" />
                                                                    </td>
                                                                </tr>

                                                            </h:panelGroup>

                                                        </ui:repeat>
                                                    </table>

                                                </td>
                                            </tr>

                                        </table>


                                    </div>
                                </h:panelGroup>



                            </div>


                        </div>
                    </div>
                    <!-- /#contents -->
                    <div id="footer" class="nonPrintBlock">
                        <div id="description">
                            <div> 
                                <span><a href="http://www.lakmedi.com">Copyright &copy; 2012 Lakmedipro Pvt Ltd. All rights reserved</a> 
                                </span></div>
                        </div>
                    </div>
                    <!-- /#footer -->
                </div>
                <!-- /#page -->
            </div>
            <!-- /#background -->

        </h:form>

    </h:body>
</html>
